
use T2Logging;
GO
-- Drop stored procedure if it already exists
IF EXISTS (
  SELECT * 
    FROM INFORMATION_SCHEMA.ROUTINES 
   WHERE SPECIFIC_CATALOG = N'T2Logging' 
	 AND SPECIFIC_SCHEMA = N'dbo'
     AND SPECIFIC_NAME = N'Log_del' 
)
   DROP PROCEDURE dbo.Log_del
GO
create procedure Log_del
	@LogID Int,
	@TS varbinary(8),	@RowsAffected int = null OUTPUT 
	
--*************************************************************
--Created By: trooks
--Name: dbo_Log_del
--Table: Log
--Database: T2Logging
--Created Date: 02/15/2013 00:00:00
--*************************************************************

as
	Begin Try
		Delete From [dbo].Log
		 where
		 @LogID = LogID
		AND @TS = TS

		Set @RowsAffected = @@ROWCOUNT;
		return 0;	
	END TRY
	BEGIN CATCH
		Set @RowsAffected = 0;
		EXEC dbo.uspLogError;
		return -1;
	END CATCH
	
GO
GRANT EXECUTE ON [T2Logging].[dbo].[Log_del] to PORTAL_T2Logging
GO
